import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    defaultAvatar: process.env.VUE_APP_DOMAIN + '/config/common/img/default_avatar.png',  //默认头像
    webUrl:'https://www.baidu.com/',
    belowShow: false,  //底部弹窗
    userType:'A',//区分 a c 端用户
    postureShow: false,  //正确的上传姿势
    exampleVertical: '',  //竖版模板示例
    errorVertical: 'this.src=""',  //默认展示的竖版图片
    errorTips: '',  //上传错误提示
    popupsShow: false,  //是否显示删除弹窗
    CompanyCode:'', //保险公司code
    CompanyName:'',//保险公司name
    BusinessNo: sessionStorage.getItem('BusinessNo'), //批次号
    uploadImgList:[], //上传图片列表
    UploadLock:true, //图片质检锁
    SwitchPhoto:1, //控制微信拍照方式，0 拍照 1拍照/相册
    ChangeCompany:{}, //保存识别后的切换公司
    Conclusion:'',
    dbName: process.env.NODE_ENV + '_' +'policy_butler',  //indexedDB库名称
    dbVersion: 1,  //indexedDB版本
    appid: process.env.VUE_APP_APPID,
    domainUrl: process.env.VUE_APP_DOMAIN + '/',  //头像域名地址
    showFooterPolicy: false,//底部上传保单组件
    showFooterPolicyMask: false,//底部上传保单组件蒙版
    guideUrl:'',//操作指南
  },
  mutations: {
    FOOTERPOLICY_STATE(state, n){
      state.showFooterPolicy = n
      state.showFooterPolicyMask = n
    },
    FOOTERPOLICYDEALY_STATE(state, n){
      if(n){
        state.showFooterPolicyMask = n 
      }else{
        state.showFooterPolicy = n
      }
      let timer = setTimeout(()=>{
        if(n){
          state.showFooterPolicy = n
        }else{
          state.showFooterPolicyMask = n 
        }        
        clearTimeout(timer)
        timer = null
      },200)
    },
    POSTURE_SHOW(state, n){
        state.postureShow = n
    },
    EXAMPLEVERTICAL(state, n){
        state.exampleVertical = n
    },
    CHANGEERRORS(state, n){
        state.errorTips = n
    },
    UPLOADIMGLIST(state,n){
        state.uploadImgList = n
    },
    COMPANY_CODE(state,n){
        state.CompanyCode = n
    },
    COMPANY_NAME(state,n){
        state.CompanyName = n
    },
    UPLOAD_LOCK(state,n){
      state.UploadLock = n
    },
    SWITCH_PHOTO(state,n){
        state.SwitchPhoto = n
    },
    CHANGE_COMPANY(state,n){
        state.ChangeCompany = n
    },
    CONCLUSION(state,n){
        state.Conclusion = n
    }
  },
  actions: {
  },
  modules: {
  }
})